package com.hailian.fintech.hlrenting_houseserver.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hailian.fintech.hlrenting_houseserver.entity.Bill;
import com.hailian.fintech.hlrenting_houseserver.service.IBillService;
import com.hailian.fintech.hlrenting_houseserver.vo.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wyt
 * @since 2020-05-21
 */
@RestController
@RequestMapping("/bill")
public class BillController {

    @Autowired
    private IBillService billService;

    /**
     * 收款单  查询
     * @param pageNum
     * @param pageSize
     * @return
     */
    @RequestMapping("list")
    public ResultEntity select(@RequestParam("pageNum")Integer pageNum,@RequestParam("pageSize")Integer pageSize){
        Page<Bill> page = new Page<>(pageNum, pageSize);
        //开启分页!
        return ResultEntity.ok("访问成功!",billService.selectObject(page));
    }

    @RequestMapping("/update")
    public ResultEntity update(@RequestBody Bill bill){
        return ResultEntity.ok("修改成功",billService.updateById(bill));
    }
}

